package com.yuda.campsite.controller;

import com.yuda.campsite.domain.OperProvince;
import com.yuda.campsite.dto.City;
import com.yuda.campsite.dto.School;
import com.yuda.campsite.service.OperSiteService;
import com.yuda.common.core.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashSet;
import java.util.List;

@RestController
public class CampProvinceCitySchool {

    @Autowired
    private OperSiteService operSiteService;

    @GetMapping("/selectProvinceNameAndId")
    @ApiOperation("查询省份名称和id")
    public HashSet<OperProvince> selectProvinceName(){
        HashSet<OperProvince> provinceNameAndIds = operSiteService.selectProvinceName();
        return provinceNameAndIds;
    }

    @GetMapping("/listCity")
    public AjaxResult listCity (Long provinceId) {
        List<City> list = operSiteService.listCity(provinceId);
        return AjaxResult.success(list);
    }

    @GetMapping("/listSchool")
    public AjaxResult listSchool (Long cityId) {
        List<School> list = operSiteService.listSchool(cityId);
        return AjaxResult.success(list);
    }


}
